package com.hb.game.pk.adpter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hb.game.pk.R;
import com.hb.game.pk.beans.IndexGame;

public class GameListAdapter extends BaseQuickAdapter<IndexGame.DataBean, BaseViewHolder> {
    private int[] images = {R.mipmap.ic_game_sl, R.mipmap.ic_game_jl, R.mipmap.ic_game_dx, R.mipmap.ic_er_ba,R.mipmap.ic_game_sz};

    public GameListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, IndexGame.DataBean item) {

        int res = 0;
        if ("扫雷".equals(item.getTitle())) {
            res = images[0];
        } else if ("接龙".equals(item.getTitle())) {
            res = images[1];
        } else if ("二八杠".equals(item.getTitle())) {
            res = images[3];
        } else if("胜者为王".equals(item.getTitle())){
            res = images[4];
        }
        if ("扫雷体验房".equals(item.getTitle())) {
            res = images[0];
        }
        helper.setImageResource(R.id.iv_game, res);
        helper.setText(R.id.tv_game_name, item.getTitle());
        helper.addOnClickListener(R.id.tv_game_rule);
    }
}
